package model;

import java.sql.Date;

public class RentReminder
{
	private String studentName;
	private String teacherName;
	private int rentPerMonth;
	private Date date_in;
	private int sumRechargeRent;

	public RentReminder(RentCost rentCost)
	{
		setStudentName(rentCost.getName());
		setTeacherName(rentCost.getTeacher_name());
		setDate_in(rentCost.getDate_in());
		setSumRechargeRent(rentCost.getAlreadyPay());
	}

	public String getStudentName()
	{
		return studentName;
	}

	public void setStudentName(String studentName)
	{
		this.studentName = studentName;
	}

	public String getTeacherName()
	{
		return teacherName;
	}

	public void setTeacherName(String teacherName)
	{
		this.teacherName = teacherName;
	}

	public Date getDate_in()
	{
		return date_in;
	}

	public void setDate_in(Date date_in)
	{
		this.date_in = date_in;
	}

	public int getSumRechargeRent()
	{
		return sumRechargeRent;
	}

	public void setSumRechargeRent(int sumRechargeRent)
	{
		this.sumRechargeRent = sumRechargeRent;
	}

	public int getRentPerMonth()
	{
		return rentPerMonth;
	}

	public void setRentPerMonth(int rentPerMonth)
	{
		this.rentPerMonth = rentPerMonth;
	}

	public boolean isQualified(long date)
	{
		long in_mills = date_in.getTime();
		long last_mills = (sumRechargeRent / rentPerMonth) * monthMilliSeconds;
		long sum = in_mills + last_mills;
		if (sum < date)
		{
			return true;
		}
		else
		{
			return false;
		}
	}

	public String getDeadLine()
	{
		long in_mills = date_in.getTime();
		long last_mills = (sumRechargeRent / rentPerMonth) * monthMilliSeconds;
		Date deadline = new Date(in_mills + last_mills);
		return deadline.toString();
	}

	private final static long monthMilliSeconds = 30 * 24 * 60 * 60 * 1000;
}
